﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PatternsApplication
{
    #region Factory1
    class Client
    {


        //static void Main(string[] args)
        //{
        //    Factory factory = new Factory();
        //    IProduct circle = factory.GetProduct(ProductType.Circle);
        //    IProduct square = factory.GetProduct(ProductType.Square);

        //    Console.WriteLine(circle.Area());
        //    Console.WriteLine(square.Area());
        //    Console.ReadKey();
        //}
    }

    internal enum ProductType
    {
        Circle,
        Square
    }

    class Factory
    {
        public Factory()
        {
        }

        public IProduct GetProduct(ProductType name)
        {
            IProduct result = null;

            switch (name)
            {
                case ProductType.Circle:
                    result = new ProductCircle(15);
                    break;

                case ProductType.Square:
                    result = new ProductTriangle(1, 1, 2, 2, 3, 3);
                    break;
            }
            return result;
        }
    }

    interface IProduct
    {
        int Area();
    }

    class ProductCircle : IProduct
    {
        public int Radius;

        public ProductCircle(int radius)
        {
            Radius = radius;
        }

        public int Area()
        {
            return 115;
        }
    }

    class ProductTriangle : IProduct
    {
        public int[,] Edges = new int[3, 2];

        public ProductTriangle(int x1, int y1, int x2, int y2, int x3, int y3)
        {
            Edges[0, 0] = x1;
            Edges[0, 1] = y1;
            Edges[1, 0] = x2;
            Edges[1, 0] = y2;
            Edges[2, 0] = x3;
            Edges[2, 1] = y3;
        }

        public override string ToString()
        {
            return Edges.ToString();
        }


        public int Area()
        {
            return 50;
        }
    }

    #endregion 

    #region Factory2
    #endregion

}
